package com.appspot.zarm.gomoku;

import com.appspot.zarm.game.Game;
import com.appspot.zarm.game.Player;

public class GomokuGame extends Game {

	private GomokuBoard board;
	private Robot robot;
	private Player thisPlayerTurn;
	

	public GomokuGame(Player player) {
		addPlayer(player);
		board = new GomokuBoardFactory().newBoard();
		robot = new Robot();
		thisPlayerTurn = player;
	}

	public GomokuBoard getBoard() {
		return board;
	}

	public void setBoard(GomokuBoard board) {
		this.board = board;
	}

	public Robot getRobot() {
		return robot;
	}

	public void setRobot(Robot robot) {
		this.robot = robot;
	}


	public Player getThisPlayerTurn() {
		return thisPlayerTurn;
	}

	public void setThisPlayerTurn(Player thisPlayerTurn) {
		this.thisPlayerTurn = thisPlayerTurn;
	}
	
	/**
	 * Validates whether player has a turn, using player session id for comparison 
	 * @param player
	 * @return
	 */
	public boolean isThisPlayerTurn(Player player) {
		if (thisPlayerTurn != null && thisPlayerTurn.equals(player)) {
			return true;
		}
		return false;
	}
	
}
